import React from 'react';
import {
    UploadOutlined,
    UserOutlined,
    VideoCameraOutlined,
    RobotOutlined,
    MoneyCollectOutlined,
    AreaChartOutlined,
    BarChartOutlined,
    FundOutlined
} from '@ant-design/icons';
import { Menu } from 'antd';
import { useNavigate, useLocation } from 'react-router-dom';
const Menus: React.FC = () => {
    const navigator = useNavigate()
    const currentRoute = useLocation()
    const rank = currentRoute.pathname.split('/')
    rank.shift()
    const itmes = [
        {
            key: 'admin',
            icon: <UserOutlined />,
            label: '管理员',
        },
        {
            key: 'user',
            icon: <RobotOutlined />,
            label: '用户管理',
        },
        {
            key: '3',
            icon: <VideoCameraOutlined />,
            label: '分类管理',
        },
        {
            key: '4',
            icon: <MoneyCollectOutlined />,
            label: '商品管理',
        },
        {
            key: '5',
            icon: <FundOutlined />,
            label: '页面数据',
            children: [
                {
                    key: '6',
                    icon: <AreaChartOutlined />,
                    label: '首页轮播图',
                },
                {
                    key: '7',
                    icon: <BarChartOutlined />,
                    label: '商品数据分析',
                }
            ]
        },
        {
            key: '8',
            icon: <UploadOutlined />,
            label: '发货/出库',
        }
    ]
    const goMenu = (e: { key: string },ss:any) =>{
        navigator(`${e.key}`)
    }
    return (<>
        <div className="demo-logo-vertical" style={{ height: 64, lineHeight: '64px' }} />
        <Menu
            mode="inline"
            defaultSelectedKeys={rank}
            items={itmes}
            onClick={(e) => goMenu(e,"哈哈")}
            style={{height:'100%'}}
        />
    </>)
}
export default Menus